package com.ruoyi.framework.configimport

import org.mybatis.spring.annotation.MapperScan
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.EnableAspectJAutoProxy
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder
import java.util.*

/**
 * 程序注解配置
 *
 * @author ruoyi
 */
@Configuration // 表示通过aop框架暴露该代理对象,AopContext能够访问
@EnableAspectJAutoProxy(exposeProxy = true) // 指定要扫描的Mapper类的包的路径
@MapperScan("com.ruoyi.project.**.mapper")
open class ApplicationConfig {
    /**
     * 时区配置
     */
    @Bean
    open fun jacksonObjectMapperCustomization(): Jackson2ObjectMapperBuilderCustomizer {
        return Jackson2ObjectMapperBuilderCustomizer { jacksonObjectMapperBuilder: Jackson2ObjectMapperBuilder ->
            jacksonObjectMapperBuilder.timeZone(
                TimeZone.getDefault()
            )
        }
    }
}
